<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="">
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <title>订单分配成功</title>
    <link href="../../css/css.css" rel="stylesheet" type="text/css">
    <script src="../../js/jquery-v1.11.2.min.js"></script>
    <script src="../../js/driver.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<section class="tabbtnarea">
    <li class="w33 rline"><span class="tabfouse">订单信息</span></li>
    <li class="w33 rline" id="goOrder2">订单轨迹</li>
    <li class="w33" id="goOrder3">费用明细</li>
</section>
<section class="itemgroup mt44">
    <div class="order_title" id="waybillNum">
        订单编号: <label class="type ml5">APP</label>
        <label class="right green" id="status">进行中</label>
    </div>
    <div class="twoitem ml15">
        <div class="w50 left">
            <label class="itemsubname">下单时间</label>
            <label class="font14" id="orderDate"></label>
        </div>
        <div class="w50 right">
            <label class="itemsubname">预订时间</label>
            <label class="font14" id="bookDates"></label>
        </div>
    </div>
    <div class="photoitem ml15 font14" id="startAddr">
        <i class="iconfont mr5 green icon20">&#xe70d;</i>
        共和新路3288弄3号
    </div>
    <div class="photoitem ml15 font14" id="endAddr">
        <i class="iconfont mr5 red icon20">&#xe70c;</i>
        共和新路3288弄3号
    </div>
    <div id="requireList">
        <div class="oneitem p15">
            <label class="gray font12">特殊要求:</label>
        </div>
    </div>
</section>
<section class="subtitle p15 mt10">叫车人信息</section>
<section class="itemgroup">
    <div class="normalitem">
        <div class="userphoto"><img src="../../img/user_photo.png" width="100%" height="100%"/></div>
        <div class="photoitem lh20">
            <div class="itemname">
                <span id="consignName"></span>
                <i class="iconfont rightsmallicon">&#xe6db;</i>
                <span class="right gray font12">联系TA</span>
            </div>
            <div class="itemsubname" id="consignMobile"></div>
        </div>
    </div>
</section>
<section class="itemgroup mt10">
    <div class="order_title">
        给司机捎句话
    </div>
    <div class="pall15 font14 lh24" id="consignDesc"></div>
</section>
<script type="text/javascript">
    $(function () {
        //token验证
        checkDriverToken();
    });
    $(document).ready(function () {
        var waybillId = GetArgsFromHref("waybillId");
        var url = _global.serverHost + "/driver/bid_ok_detail.htm";
        var data = {waybillId: waybillId};
        _callAjaxRequest(url, data, goBidOkDetailBack);

        function goBidOkDetailBack(data) {
            var waybillSource = "订单编号:" + data.waybill.waybillNum;
            if (data.waybill.waybillSource == '10') {
                waybillSource = waybillSource +"<label class='type ml5'>APP</label>";
            } else if (data.waybill.waybillSource == '20') {
                waybillSource = waybillSource +"<label class='type ml5'>网站</label>";
            } else if (data.waybill.waybillSource == '30') {
                waybillSource = waybillSource +"<label class='type ml5'>客服电话</label>";
            }
            waybillSource = waybillSource;
            $("#waybillNum").html(waybillSource);

            var status = "";
            if (data.waybill.status == '30') {
                status = "进行中";
            } else if (data.waybill.status == '40') {
                status = "就位";
            } else if (data.waybill.status == '50') {
                status = "装货完成";
            } else if (data.waybill.status == '60') {
                status = "到达目的地";
            } else if (data.waybill.status == '70') {
                status = "完成卸货";
            } else if (data.waybill.status == '80') {
                status = "等待评价";
            } else if (data.waybill.status == '90') {
                status = "订单完成";
            }
            $("#status").html(status);
            $("#orderDate").html(data.waybill.orderDate);
            $("#bookDates").html(data.waybill.bookDates);

            $("#startAddr").html('<i class="iconfont mr5 green icon20">&#xe70d;</i>' + data.waybill.startAddr);
            $("#endAddr").html('<i class="iconfont mr5 red icon20">&#xe70c;</i>' + data.waybill.endAddr);

            var require = "";
            if (data.requireList > 0) {
                require = '<div class="oneitem p15">'
                    + '<label class="gray font12">特殊要求:</label>';
                for (var j = 0; j < data.requireList.length; j++) {
                    require = require + '<div class="comments_type right';
                    if (j > 0) {
                        require = require + ' mr5';
                    }
                    require = require + '">' + data.requireList[j].requirementName + '</div>';
                }
                require = require + '</div>';
            }
            $("#requireList").html(require);
            $("#consignName").html(data.waybill.consignName);
            $("#consignMobile").html(data.waybill.consignMobile);
            $("#consignDesc").html(data.waybill.consignDesc);
            $("#goOrder2").attr("onclick", "goOrder2('" + data.waybill.waybillId + "')");
            $("#goOrder3").attr("onclick", "goOrder3('" + data.waybill.waybillId + "')");
        }
    });

    function goOrder3(waybillId) {
        window.location.href = "../bid/bid_ok_detail3.html?waybillId=" + waybillId;
    }

    function goOrder2(waybillId) {
        window.location.href = "../bid/bid_ok_detail2.html?waybillId=" + waybillId;
    }
</script>
</body>
</html>